package com.masiyi.sentinel.controller;

import com.alibaba.csp.sentinel.AsyncEntry;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.masiyi.sentinel.service.AsyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestAnnController {


    @SentinelResource(value = "testSentinel_ann",blockHandler = "exceptionHandler")
    @GetMapping("/ann")
    public String hello() {
        return "hello sentinel";
    }

    public String exceptionHandler(BlockException e) {
        e.printStackTrace();
        return "系统繁忙";
    }


}
